package uhaleks;

import java.util.ArrayList;

/**
 * Created by Александр on 11.07.2014.
 */
public class Word implements Comparable {
    private String word;
    private int freq;

    public Word(String word, int freq) {
        this.word = word;
        this.freq = freq;
    }

    public String getWord() {
        return word;
    }

    public int getFreq() {
        return freq;
    }

    public void incFreq() {
        freq++;
    }

    @Override
    public int compareTo(Object o) {
        Word w = (Word)o;
        if (this.freq < w.freq)
            return -1;
        else if (this.freq > w.freq)
            return 1;
        return 0;
    }

    @Override
    public String toString() {
        return word + "; " + freq;
    }
}
